import pandas as pd

from dash import dcc
from dash import html
from dash.dependencies import Input,Output

import plotly.express as px

def generate_table(df,id,max_rows=10):
    """
    General table
    """
    return html.Table([
        html.Thead([
            html.Tr([
                html.Td(col) for col in df.columns
            ])
        ]),
        html.Tbody([
            html.Tr([html.Td(df.iloc[i][col]) for col in df.columns]) 
            for i in range(min(len(df),max_rows))
        ])    
    ],id=id)

tab_df = pd.read_csv('https://gist.githubusercontent.com/chriddyp/c78bf172206ce24f77d6363a2d754b59/raw/c353e8ef842413cae56ae3920b8fd78468aa4cb2/usa-agricultural-exports-2011.csv')

test_tab = generate_table(tab_df,"test_tab")




